/*
 *	Copyright (c) 2013, Yulong Information Technologies
 *	All rights reserved.
 *  
 *  @Project: bbs
 *  @author: Robot
 *	@email: feng88724@126.com
 */
package com.wangyong.bbs.web.action;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.wangyong.bbs.dao.UserDao;

/**
 * @author Robot
 * @weibo http://weibo.com/feng88724
 * @date Mar 7, 2013	
 */
public class LoginAction extends ActionSupport {

	@Override
	public String execute() throws Exception {
		ActionContext ctx = ActionContext.getContext();
		HttpServletRequest request = ServletActionContext.getRequest();
		
		String name = (String)request.getParameter("name");
		String psw = (String)request.getParameter("password");
		boolean result = UserDao.isUserValid(name, psw);
		System.out.println(result);
		if(result) {
			return SUCCESS;
		} else {
			return ERROR;
		}
	}

}
